package com.zhouyong.message;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

/**
 * @author Y5696
 * @date 2023/3/13 11:20
 */
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class RpcResponseMessage extends Message {

    private Integer code;
    private Object data;
    private String message;

    public RpcResponseMessage(int sequenceId, Integer code, Object data, String message) {
        super(sequenceId, Message.RPC_MESSAGE_TYPE_RESPONSE);
        this.code = code;
        this.data = data;
        this.message = message;
    }

    @Override
    public int getMessageType() {
        return Message.RPC_MESSAGE_TYPE_RESPONSE;
    }

    @Override
    public String toString() {
        return "RpcResponseMessage{" +
                "code=" + code +
                ", data=" + data +
                ", message='" + message + '\'' +
                '}' + "\n" + super.toString();
    }
}
